using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.ObjectModel;
using System.Data.SqlClient;
using System.Collections.Generic;

/// <summary>
/// Summary description for FacebookUser
/// </summary>
public class FacebookUser
{
    private int _id;

    public int ID
    {
        get
        {
            return this._id;
        }

        set
        {
            this._id = value;
        }
    }

	public FacebookUser()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public static ReadOnlyCollection<FacebookUser> GetFacebookUsers(int workItemID)
    {
        SqlDataReader reader = DbConnection.ExecuteSelect("SELECT FacebookUser.* FROM WorkItemFacebookUser,FacebookUser WHERE WorkItemFacebookUser.FacebookUser_ID = FacebookUser.ID AND WorkItem_ID=" + workItemID.ToString());

        return FacebookUser.GetBusinessObjects(reader);
    }

    public static ReadOnlyCollection<FacebookUser> GetBusinessObjects(SqlDataReader reader)
    {
        List<FacebookUser> _list = new List<FacebookUser>();

        while (reader.Read())
        {
            FacebookUser user = new FacebookUser();

            user.ID = int.Parse(reader["ID"].ToString());

            _list.Add(user);
        }

        return _list.AsReadOnly();
    }

}
